<?php
session_start();

if (!isset($_SESSION['subjects']))
{
	$_SESSION['subjects'] = array(
		"1" => array("subject" => "Maths"),
		"2" => array("subject" => "Computer Studies"),
		"3" => array("subject" => "Physics")
	);
}
$subjects = &$_SESSION['subjects'];

$output = array();
foreach ($subjects as $id => $row)
{
	$output[] = array( "id" => $id, "subject" => $row["subject"] );
}
echo json_encode($output);
?>